//
//  Note.m
//  geoNotes
//
//  Created by Administrator on 6/23/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "Note.h"


@implementation Note
@synthesize title,message,lat,lon;
-(id) init{
    self=[super init];
    return self;
}
-(id) initWithTitle:(NSString*) _title andMessage:(NSString*) _message withLatitude:(NSNumber*) _lat andLongitude:(NSNumber*) _lon{
    self=[self init];
    if(self)
    {
        self.title=_title;
        self.message=_message;
        self.lat=_lat;
        self.lon=_lon;
    }
    return self;
}
-(NSString *)description{
    return [NSString stringWithFormat:@"title: %@ message: %@ \n",title,message];
}
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:title forKey:@"NoteTitle"];
    [aCoder encodeObject:message forKey:@"NoteMessage"];
    [aCoder encodeObject:lat forKey:@"NoteLat"];
    [aCoder encodeObject:lon forKey:@"NoteLon"];

    
}
- (id)initWithCoder:(NSCoder *)aDecoder{
    self=[super init];
    if(self){
        title= [[aDecoder decodeObjectForKey:@"NoteTitle"] retain];
        message= [[aDecoder decodeObjectForKey:@"NoteMessage"] retain];
        lat= [[aDecoder decodeObjectForKey:@"NoteLat"] retain];
        lon= [[aDecoder decodeObjectForKey:@"NoteLon"] retain];

    }
    return self;
}
@end
